package com.iplatform.iplatformuser.privilege.dao;

import com.iplatform.module.privilege.CompatibilityBean;
import com.iplatform.module.privilege.PriManagerBean;
import com.iplatform.module.privilege.PriMenuBean;
import com.iplatform.module.privilege.PriRoleBean;
import com.iplatform.module.privilege.group.PriGroupInfoBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * Title: PriRoleMapper
 * Description:
 *
 * @author RayLLi
 * @date 2018年8月28日
 */
@Mapper
public interface PriRoleMapper {

    /**
     * Title: findRoleIdByMrgId
     * Description:
     *
     * @param mgrId
     * @return
     */
    public List<String> findRoleIdByMrgId(String mgrId);

    /**
     * Title: queryRole
     * Description:
     *
     * @param formMap
     * @return
     */
    public PriRoleBean queryRole(Map<String, String> formMap);

    /**
     * Title: loadRole
     * Description:
     *
     * @param formMap
     * @return
     */
    public List<PriRoleBean> loadRole(Map<String, String> formMap);

    /**
     * Title: insert
     * Description:
     *
     * @param priRoleBean
     * @return
     */
    public int insert(PriRoleBean priRoleBean);

    /**
     * Title: update
     * Description:
     *
     * @param priRoleBean
     * @return
     */
    public int update(PriRoleBean priRoleBean);

    /**
     * Title: delete
     * Description:
     *
     * @param roleId
     * @return
     */
    public int delete(String roleId);

    /**
     * Title: batchDelete
     * Description:
     *
     * @param roleIds
     */
    public void batchDelete(String[] roleIds);

    /**
     * Title: setIsUse
     * Description:
     *
     * @param roleId
     */
    public void setIsUse(String roleId);

    /**
     * Title: querySelectManagerWithRoleId
     * Description:
     *
     * @param formMap
     * @return
     */
    public List<PriManagerBean> querySelectManagerWithRoleId(Map<String, String> formMap);

    /**
     * Title: querySelectManagerWithOutRoleId
     * Description:
     *
     * @param formMap
     * @return
     */
    public List<PriManagerBean> querySelectManagerWithOutRoleId(Map<String, String> formMap);

    /**
     * Title: deleteManagerWithRoleId
     * Description:
     *
     * @param roleId
     */
    public void deleteManagerWithRoleId(@Param("roleId") String roleId);

    /**
     * Title: updateManagerRole
     * Description:
     *
     * @param formMap
     */
//    public void updateManagerRole(Map<String, String> formMap);
    public void updateManagerRole(List<Map<String, String>> formMap);

    /**
     * Title: roleSelectedMenu
     * Description:
     *
     * @param formMap
     */
    public void roleSelectedMenu(Map<String, String> formMap);

    /**
     * Title: roleSelectedOpt
     * Description:
     *
     * @param formMap
     */
    public void roleSelectedOpt(Map<String, String> formMap);

    /**
     * Title: deleteRoleMenu
     * Description:
     *
     * @param roleId
     */
    public void deleteRoleMenu(@Param("roleId") String roleId);

    /**
     * Title: deleteRoleOpt
     * Description:
     *
     * @param roleId
     */
    public void deleteRoleOpt(@Param("roleId") String roleId);

    /**
     * Title: queryAllOptByMenuIds
     * Description:
     *
     * @param formMap
     * @return
     */
    public List<Map<String, String>> queryAllOptByMenuIds(Map<String, String> formMap);

    /**
     * Title: deleteTarget
     * Description:
     *
     * @param roleId
     * @param targetId
     */
    public void deleteTarget(@Param("roleId") String roleId, @Param("targetId") String targetId);

    /**
     * deleteTargetByRoleId
     *
     * @param formMap
     */
    public void deleteTargetByRoleId(Map<String, String> formMap);

    /**
     * Title: isRoleSelectTarget
     * Description:
     *
     * @param roleId
     * @param targetId
     * @return
     */
    public String isRoleSelectTarget(@Param("roleId") String roleId, @Param("targetId") String targetId);

    /**
     * Title: selectTarget
     * Description:
     *
     * @param formMap
     */
    public void selectTarget(Map<String, String> formMap);

    /**
     * Title: queryOrg
     * Description:
     *
     * @return
     */
    public List<CompatibilityBean> queryOrg();


    /**
     * Title: findGroupByRoleId
     * Description:
     *
     * @param roleId
     * @return
     */
    public List<PriGroupInfoBean> findGroupByRoleId(String roleId);


    /**
     * Title: delWithRoleId
     * Description: 根据RoleId删除记录
     *
     * @param formMap
     */
    void delWithRoleId(String roleId);
    /**
     * Title: updateRoleGroup
     * Description: 绑定权限组信息
     * @param menuId
     */
//	void updateRoleGroup(Map<String, String> formMap);

    /**
     * <p>Title: listSelectWithOutGroup</p>
     * <p>Description: 绑定权限组页面---未选择当前角色的列表信息</p>
     * @param formMap
     * @return
     */
//	List<Map<String, String>> listSelectWithOutGroup(Map<String, String> formMap);

    /**
     * Title: listSelectWithOutGroup
     * Description: 绑定权限组页面---已选择当前角色的列表信息
     * @param formMap
     * @return
     */
//	List<Map<String, String>> listSelectWithInGroup(Map<String, String> formMap);

    /**
     * Title: queryRoleName
     * Description: 联想功能
     *
     * @param formMap
     * @return
     */
    List<Map<String, String>> queryRoleName();

    /**
     * 同步角色默认指标至用户
     *
     * @param formMap
     */
    public void SynTarget(Map<String, String> formMap);

    /**
     * 清空角色绑定用户的默认指标
     *
     * @param formMap
     */
    public void delDefaultTarget(Map<String, String> formMap);

    /**
     * 查询角色已绑定默认指标ID
     *
     * @param formMap
     * @return
     */
    public List<Map<String, String>> selectTargetPageForInRole(Map<String, String> formMap);

    /**
     * 删除角色绑定用户
     *
     * @param formMap
     */
    public void delManagerRole(Map<String, String> formMap);

    /**
     * 用户绑定默认指标
     *
     * @param formMap
     */
    public void insertDefaultTareget(Map<String, String> formMap);

    /**
     * 删除绑定角色用户时同时删除用户绑定的指标
     *
     * @param formMap
     */
    public void delDefaultTargetAll(Map<String, String> formMap);

    public List<Map<String, String>> querySelectTargetWithOutRoleId(Map<String, String> formMap);

    public List<Map<String, String>> querySelectTargetWithRoleId(Map<String, String> formMap);

    public void deleteTargetWithRoleId(Map<String, String> delMap);

    public void updateTargetRole(Map<String, String> formMap);

    /**
     * 角色绑定菜单的菜单列表
     *
     * @param roleId
     * @return
     */
    public List<PriMenuBean> queryMenuListWithRoleId(@Param("roleId") String roleId, @Param("menuName") String menuName);

    /**
     * 添加时判重
     *
     * @param roleCode
     * @param roleId
     * @return
     */
    public int addCheck(@Param("roleCode") String roleCode, @Param("roleId") String roleId);

    /**
     * 登陆时查询用户角色信息
     *
     * @param mgrId
     * @return
     */
    public PriRoleBean getRole(@Param("mgrId") String mgrId);

    /**
     * 角色绑定菜单
     *
     * @param roleId
     * @param menuId
     * @param version
     */
    public void RoleBindMenus(@Param("roleId") String roleId, @Param("menuId") String menuId, @Param("version") BigDecimal version);

    /**
     * 移除绑定
     *
     * @param roleId
     * @param menuId
     */
    public void romoveBind(@Param("roleId") String roleId, @Param("menuId") String menuId);

    /**
     * 删除角色绑定用户
     *
     * @param roleId
     */
    void delRoleManager(@Param("roleId") String roleId);
}
